<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libcoap: net.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">libcoap<span id="projectnumber">&#160;4.2.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('net_8h.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">net.h File Reference</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;assert.h&gt;</code><br />
<code>#include &lt;stdlib.h&gt;</code><br />
<code>#include &lt;string.h&gt;</code><br />
<code>#include &lt;sys/time.h&gt;</code><br />
<code>#include &lt;time.h&gt;</code><br />
<code>#include &quot;<a class="el" href="coap__io_8h_source.html">coap_io.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="coap__dtls_8h_source.html">coap_dtls.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="coap__event_8h_source.html">coap_event.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="coap__time_8h_source.html">coap_time.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="option_8h_source.html">option.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="pdu_8h_source.html">pdu.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="prng_8h_source.html">prng.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="coap__session_8h_source.html">coap_session.h</a>&quot;</code><br />
</div>
<p><a href="net_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Queue entry.  <a href="structcoap__queue__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structcoap__context__t.html">coap_context_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The CoAP stack's global state is stored in a <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a> object.  <a href="structcoap__context__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a548dc6ec3268d22d2a314fa132f548c1" id="r_a548dc6ec3268d22d2a314fa132f548c1"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structcoap__queue__t.html">coap_queue_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a548dc6ec3268d22d2a314fa132f548c1">coap_queue_t</a></td></tr>
<tr class="memdesc:a548dc6ec3268d22d2a314fa132f548c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Queue entry.  <br /></td></tr>
<tr class="separator:a548dc6ec3268d22d2a314fa132f548c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae74b51652af6ed6620d101dc9a8a2431" id="r_ae74b51652af6ed6620d101dc9a8a2431"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#ae74b51652af6ed6620d101dc9a8a2431">coap_response_handler_t</a>) (struct <a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *sent, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *received, const <a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> id)</td></tr>
<tr class="memdesc:ae74b51652af6ed6620d101dc9a8a2431"><td class="mdescLeft">&#160;</td><td class="mdescRight">Response handler that is used as call-back in <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a>.  <br /></td></tr>
<tr class="separator:ae74b51652af6ed6620d101dc9a8a2431"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4f398929eef5944941ec6aa790f3abea" id="r_a4f398929eef5944941ec6aa790f3abea"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a4f398929eef5944941ec6aa790f3abea">coap_nack_handler_t</a>) (struct <a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *sent, <a class="el" href="coap__io_8h.html#a7ff2bb32137ca684be5539c156bdc418">coap_nack_reason_t</a> reason, const <a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> id)</td></tr>
<tr class="memdesc:a4f398929eef5944941ec6aa790f3abea"><td class="mdescLeft">&#160;</td><td class="mdescRight">Negative Acknowedge handler that is used as call-back in <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a>.  <br /></td></tr>
<tr class="separator:a4f398929eef5944941ec6aa790f3abea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4441ca51ddb6294729bd5f6971769d5f" id="r_a4441ca51ddb6294729bd5f6971769d5f"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a4441ca51ddb6294729bd5f6971769d5f">coap_ping_handler_t</a>) (struct <a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *received, const <a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> id)</td></tr>
<tr class="memdesc:a4441ca51ddb6294729bd5f6971769d5f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Recieved Ping handler that is used as call-back in <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a>.  <br /></td></tr>
<tr class="separator:a4441ca51ddb6294729bd5f6971769d5f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a89aa2bb8a2345d32463a27fa5a4a5acc" id="r_a89aa2bb8a2345d32463a27fa5a4a5acc"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a89aa2bb8a2345d32463a27fa5a4a5acc">coap_pong_handler_t</a>) (struct <a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *received, const <a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> id)</td></tr>
<tr class="memdesc:a89aa2bb8a2345d32463a27fa5a4a5acc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Recieved Pong handler that is used as call-back in <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a>.  <br /></td></tr>
<tr class="separator:a89aa2bb8a2345d32463a27fa5a4a5acc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7a23545549ba965bdcc52ebf53b102f" id="r_ac7a23545549ba965bdcc52ebf53b102f"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structcoap__context__t.html">coap_context_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#ac7a23545549ba965bdcc52ebf53b102f">coap_context_t</a></td></tr>
<tr class="memdesc:ac7a23545549ba965bdcc52ebf53b102f"><td class="mdescLeft">&#160;</td><td class="mdescRight">The CoAP stack's global state is stored in a <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a> object.  <br /></td></tr>
<tr class="separator:ac7a23545549ba965bdcc52ebf53b102f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a80d2c3b0141e98bf3f7914e7e59b9530" id="r_a80d2c3b0141e98bf3f7914e7e59b9530"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a80d2c3b0141e98bf3f7914e7e59b9530">coap_insert_node</a> (<a class="el" href="structcoap__queue__t.html">coap_queue_t</a> **queue, <a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *node)</td></tr>
<tr class="memdesc:a80d2c3b0141e98bf3f7914e7e59b9530"><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds <code>node</code> to given <code>queue</code>, ordered by variable t in <code>node</code>.  <br /></td></tr>
<tr class="separator:a80d2c3b0141e98bf3f7914e7e59b9530"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a44c39a2314035989d3e07b9d9328e08c" id="r_a44c39a2314035989d3e07b9d9328e08c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a44c39a2314035989d3e07b9d9328e08c">coap_delete_node</a> (<a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *node)</td></tr>
<tr class="memdesc:a44c39a2314035989d3e07b9d9328e08c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys specified <code>node</code>.  <br /></td></tr>
<tr class="separator:a44c39a2314035989d3e07b9d9328e08c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2c1e86998c712346baf2d116dbf1ac7f" id="r_a2c1e86998c712346baf2d116dbf1ac7f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a2c1e86998c712346baf2d116dbf1ac7f">coap_delete_all</a> (<a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *queue)</td></tr>
<tr class="memdesc:a2c1e86998c712346baf2d116dbf1ac7f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Removes all items from given <code>queue</code> and frees the allocated storage.  <br /></td></tr>
<tr class="separator:a2c1e86998c712346baf2d116dbf1ac7f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adbf4c617bdb13f0b61f83dca2ecdcc9e" id="r_adbf4c617bdb13f0b61f83dca2ecdcc9e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#adbf4c617bdb13f0b61f83dca2ecdcc9e">coap_new_node</a> (void)</td></tr>
<tr class="memdesc:adbf4c617bdb13f0b61f83dca2ecdcc9e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new node suitable for adding to the CoAP sendqueue.  <br /></td></tr>
<tr class="separator:adbf4c617bdb13f0b61f83dca2ecdcc9e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7cba9a2fabbd31cb622b828d2415a12c" id="r_a7cba9a2fabbd31cb622b828d2415a12c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a7cba9a2fabbd31cb622b828d2415a12c">coap_register_response_handler</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="net_8h.html#ae74b51652af6ed6620d101dc9a8a2431">coap_response_handler_t</a> handler)</td></tr>
<tr class="memdesc:a7cba9a2fabbd31cb622b828d2415a12c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers a new message handler that is called whenever a response was received that matches an ongoing transaction.  <br /></td></tr>
<tr class="separator:a7cba9a2fabbd31cb622b828d2415a12c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae150823383d9c96c22076e37de9a8192" id="r_ae150823383d9c96c22076e37de9a8192"><td class="memItemLeft" align="right" valign="top"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#ae150823383d9c96c22076e37de9a8192">coap_register_nack_handler</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="net_8h.html#a4f398929eef5944941ec6aa790f3abea">coap_nack_handler_t</a> handler)</td></tr>
<tr class="memdesc:ae150823383d9c96c22076e37de9a8192"><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers a new message handler that is called whenever a confirmable message (request or response) is dropped after all retries have been exhausted, or a rst message was received, or a network or TLS level event was received that indicates delivering the message is not possible.  <br /></td></tr>
<tr class="separator:ae150823383d9c96c22076e37de9a8192"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0271cb8bba386ce230dd30496bbc8670" id="r_a0271cb8bba386ce230dd30496bbc8670"><td class="memItemLeft" align="right" valign="top"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a0271cb8bba386ce230dd30496bbc8670">coap_register_ping_handler</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="net_8h.html#a4441ca51ddb6294729bd5f6971769d5f">coap_ping_handler_t</a> handler)</td></tr>
<tr class="memdesc:a0271cb8bba386ce230dd30496bbc8670"><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers a new message handler that is called whenever a CoAP Ping message is received.  <br /></td></tr>
<tr class="separator:a0271cb8bba386ce230dd30496bbc8670"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4af0d2a6075413637f8099fc9c59896b" id="r_a4af0d2a6075413637f8099fc9c59896b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a4af0d2a6075413637f8099fc9c59896b">coap_register_pong_handler</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="net_8h.html#a89aa2bb8a2345d32463a27fa5a4a5acc">coap_pong_handler_t</a> handler)</td></tr>
<tr class="memdesc:a4af0d2a6075413637f8099fc9c59896b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers a new message handler that is called whenever a CoAP Pong message is received.  <br /></td></tr>
<tr class="separator:a4af0d2a6075413637f8099fc9c59896b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a696acd1012ad1c2dba081ee5bea54fd8" id="r_a696acd1012ad1c2dba081ee5bea54fd8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a696acd1012ad1c2dba081ee5bea54fd8">coap_register_option</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *ctx, uint16_t type)</td></tr>
<tr class="memdesc:a696acd1012ad1c2dba081ee5bea54fd8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers the option type <code>type</code> with the given context object <code>ctx</code>.  <br /></td></tr>
<tr class="separator:a696acd1012ad1c2dba081ee5bea54fd8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a116b4fec1683a94831f02b3e1a54dcac" id="r_a116b4fec1683a94831f02b3e1a54dcac"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a116b4fec1683a94831f02b3e1a54dcac">coap_adjust_basetime</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *ctx, <a class="el" href="group__clock.html#ga97ff1502e211b4ee6c3f15a598833438">coap_tick_t</a> now)</td></tr>
<tr class="memdesc:a116b4fec1683a94831f02b3e1a54dcac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set sendqueue_basetime in the given context object <code>ctx</code> to <code>now</code>.  <br /></td></tr>
<tr class="separator:a116b4fec1683a94831f02b3e1a54dcac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4a9f7d31eafd7d82776f9b1a9291eea0" id="r_a4a9f7d31eafd7d82776f9b1a9291eea0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a4a9f7d31eafd7d82776f9b1a9291eea0">coap_peek_next</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context)</td></tr>
<tr class="memdesc:a4a9f7d31eafd7d82776f9b1a9291eea0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the next pdu to send without removing from sendqeue.  <br /></td></tr>
<tr class="separator:a4a9f7d31eafd7d82776f9b1a9291eea0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a740acba1e579ecec3c67eca3b7522164" id="r_a740acba1e579ecec3c67eca3b7522164"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a740acba1e579ecec3c67eca3b7522164">coap_pop_next</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context)</td></tr>
<tr class="memdesc:a740acba1e579ecec3c67eca3b7522164"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the next pdu to send and removes it from the sendqeue.  <br /></td></tr>
<tr class="separator:a740acba1e579ecec3c67eca3b7522164"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1ab369ca0a3c4fe7f8a9e0536346ff71" id="r_a1ab369ca0a3c4fe7f8a9e0536346ff71"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a1ab369ca0a3c4fe7f8a9e0536346ff71">coap_new_context</a> (const <a class="el" href="structcoap__address__t.html">coap_address_t</a> *listen_addr)</td></tr>
<tr class="memdesc:a1ab369ca0a3c4fe7f8a9e0536346ff71"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a> object that will hold the CoAP stack status.  <br /></td></tr>
<tr class="separator:a1ab369ca0a3c4fe7f8a9e0536346ff71"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a665601c3c9ac88ef92125c1e62d679b2" id="r_a665601c3c9ac88ef92125c1e62d679b2"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a665601c3c9ac88ef92125c1e62d679b2">coap_context_set_psk</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, const char *hint, const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *key, size_t key_len)</td></tr>
<tr class="memdesc:a665601c3c9ac88ef92125c1e62d679b2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the context's default PSK hint and/or key for a server.  <br /></td></tr>
<tr class="separator:a665601c3c9ac88ef92125c1e62d679b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a35b413b8771487a5384cfe670553276a" id="r_a35b413b8771487a5384cfe670553276a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a35b413b8771487a5384cfe670553276a">coap_context_set_pki</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__dtls__pki__t.html">coap_dtls_pki_t</a> *setup_data)</td></tr>
<tr class="memdesc:a35b413b8771487a5384cfe670553276a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the context's default PKI information for a server.  <br /></td></tr>
<tr class="separator:a35b413b8771487a5384cfe670553276a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b56f148fda46ca44655e1a9b373b97e" id="r_a7b56f148fda46ca44655e1a9b373b97e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a7b56f148fda46ca44655e1a9b373b97e">coap_context_set_pki_root_cas</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, const char *ca_file, const char *ca_dir)</td></tr>
<tr class="memdesc:a7b56f148fda46ca44655e1a9b373b97e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the context's default Root CA information for a client or server.  <br /></td></tr>
<tr class="separator:a7b56f148fda46ca44655e1a9b373b97e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acc875c3095491f3835f4d252bd72999d" id="r_acc875c3095491f3835f4d252bd72999d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#acc875c3095491f3835f4d252bd72999d">coap_context_set_keepalive</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, unsigned int seconds)</td></tr>
<tr class="memdesc:acc875c3095491f3835f4d252bd72999d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the context keepalive timer for sessions.  <br /></td></tr>
<tr class="separator:acc875c3095491f3835f4d252bd72999d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ade36148140b152d713b23d17bbcf0024" id="r_ade36148140b152d713b23d17bbcf0024"><td class="memItemLeft" align="right" valign="top"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#ade36148140b152d713b23d17bbcf0024">coap_new_message_id</a> (<a class="el" href="structcoap__session__t.html">coap_session_t</a> *session)</td></tr>
<tr class="memdesc:ade36148140b152d713b23d17bbcf0024"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a new message id and updates <code>session-&gt;tx_mid</code> accordingly.  <br /></td></tr>
<tr class="separator:ade36148140b152d713b23d17bbcf0024"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4a0717822713783908dd33d300440b2e" id="r_a4a0717822713783908dd33d300440b2e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a4a0717822713783908dd33d300440b2e">coap_free_context</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context)</td></tr>
<tr class="memdesc:a4a0717822713783908dd33d300440b2e"><td class="mdescLeft">&#160;</td><td class="mdescRight">CoAP stack context must be released with <a class="el" href="net_8h.html#a4a0717822713783908dd33d300440b2e" title="CoAP stack context must be released with coap_free_context().">coap_free_context()</a>.  <br /></td></tr>
<tr class="separator:a4a0717822713783908dd33d300440b2e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ace22e7d3745fb725552c929b4da55c61" id="r_ace22e7d3745fb725552c929b4da55c61"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#ace22e7d3745fb725552c929b4da55c61">coap_set_app_data</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, void *data)</td></tr>
<tr class="memdesc:ace22e7d3745fb725552c929b4da55c61"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stores <code>data</code> with the given CoAP context.  <br /></td></tr>
<tr class="separator:ace22e7d3745fb725552c929b4da55c61"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aba2c62403587c8ee4e87adaffe9202da" id="r_aba2c62403587c8ee4e87adaffe9202da"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#aba2c62403587c8ee4e87adaffe9202da">coap_get_app_data</a> (const <a class="el" href="structcoap__context__t.html">coap_context_t</a> *context)</td></tr>
<tr class="memdesc:aba2c62403587c8ee4e87adaffe9202da"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns any application-specific data that has been stored with <code>context</code> using the function <a class="el" href="net_8h.html#ace22e7d3745fb725552c929b4da55c61" title="Stores data with the given CoAP context.">coap_set_app_data()</a>.  <br /></td></tr>
<tr class="separator:aba2c62403587c8ee4e87adaffe9202da"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa54bb684429ee455f119fc5fb1feb197" id="r_aa54bb684429ee455f119fc5fb1feb197"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#aa54bb684429ee455f119fc5fb1feb197">coap_new_error_response</a> (<a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *request, unsigned char code, <a class="el" href="group__opt__filter.html#ga001c5b06ae9e02996509516871cb69a8">coap_opt_filter_t</a> opts)</td></tr>
<tr class="memdesc:aa54bb684429ee455f119fc5fb1feb197"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new ACK PDU with specified error <code>code</code>.  <br /></td></tr>
<tr class="separator:aa54bb684429ee455f119fc5fb1feb197"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab31cd76353f751ec4dc5c033152df575" id="r_ab31cd76353f751ec4dc5c033152df575"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#ab31cd76353f751ec4dc5c033152df575">coap_send_error</a> (<a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *request, unsigned char code, <a class="el" href="group__opt__filter.html#ga001c5b06ae9e02996509516871cb69a8">coap_opt_filter_t</a> opts)</td></tr>
<tr class="memdesc:ab31cd76353f751ec4dc5c033152df575"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends an error response with code <code>code</code> for request <code>request</code> to <code>dst</code>.  <br /></td></tr>
<tr class="separator:ab31cd76353f751ec4dc5c033152df575"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6aa830b46188549b51773f724eb8e752" id="r_a6aa830b46188549b51773f724eb8e752"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a6aa830b46188549b51773f724eb8e752">coap_send_message_type</a> (<a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *request, unsigned char type)</td></tr>
<tr class="memdesc:a6aa830b46188549b51773f724eb8e752"><td class="mdescLeft">&#160;</td><td class="mdescRight">Helper funktion to create and send a message with <code>type</code> (usually ACK or RST).  <br /></td></tr>
<tr class="separator:a6aa830b46188549b51773f724eb8e752"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aba278b109415057d15196fa46afee970" id="r_aba278b109415057d15196fa46afee970"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#aba278b109415057d15196fa46afee970">coap_send_ack</a> (<a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *request)</td></tr>
<tr class="memdesc:aba278b109415057d15196fa46afee970"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends an ACK message with code <code>0</code> for the specified <code>request</code> to <code>dst</code>.  <br /></td></tr>
<tr class="separator:aba278b109415057d15196fa46afee970"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5854b1394bfddd574e48af116e3aaaf9" id="r_a5854b1394bfddd574e48af116e3aaaf9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> <a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a5854b1394bfddd574e48af116e3aaaf9">coap_send_rst</a> (<a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *request)</td></tr>
<tr class="memdesc:a5854b1394bfddd574e48af116e3aaaf9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends an RST message with code <code>0</code> for the specified <code>request</code> to <code>dst</code>.  <br /></td></tr>
<tr class="separator:a5854b1394bfddd574e48af116e3aaaf9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab0b0b5db03427c4313c01ec2b12cf8ed" id="r_ab0b0b5db03427c4313c01ec2b12cf8ed"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#ab0b0b5db03427c4313c01ec2b12cf8ed">coap_send</a> (<a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *pdu)</td></tr>
<tr class="memdesc:ab0b0b5db03427c4313c01ec2b12cf8ed"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a CoAP message to given peer.  <br /></td></tr>
<tr class="separator:ab0b0b5db03427c4313c01ec2b12cf8ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9900c032b74bd57f67d489484a2b3207" id="r_a9900c032b74bd57f67d489484a2b3207"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a9900c032b74bd57f67d489484a2b3207">coap_retransmit</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *node)</td></tr>
<tr class="memdesc:a9900c032b74bd57f67d489484a2b3207"><td class="mdescLeft">&#160;</td><td class="mdescRight">Handles retransmissions of confirmable messages.  <br /></td></tr>
<tr class="separator:a9900c032b74bd57f67d489484a2b3207"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaac86ac50793f309678e4951ecf8863f" id="r_aaac86ac50793f309678e4951ecf8863f"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#aaac86ac50793f309678e4951ecf8863f">coap_write</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *ctx, <a class="el" href="structcoap__socket__t.html">coap_socket_t</a> *sockets[], unsigned int max_sockets, unsigned int *num_sockets, <a class="el" href="group__clock.html#ga97ff1502e211b4ee6c3f15a598833438">coap_tick_t</a> now)</td></tr>
<tr class="memdesc:aaac86ac50793f309678e4951ecf8863f"><td class="mdescLeft">&#160;</td><td class="mdescRight">For applications with their own message loop, send all pending retransmits and return the list of sockets with events to wait for and the next timeout The application should call coap_read, then coap_write again when any condition below is true:  <br /></td></tr>
<tr class="separator:aaac86ac50793f309678e4951ecf8863f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0748d791fd2af516dd93fbadb660d440" id="r_a0748d791fd2af516dd93fbadb660d440"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a0748d791fd2af516dd93fbadb660d440">coap_read</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *ctx, <a class="el" href="group__clock.html#ga97ff1502e211b4ee6c3f15a598833438">coap_tick_t</a> now)</td></tr>
<tr class="memdesc:a0748d791fd2af516dd93fbadb660d440"><td class="mdescLeft">&#160;</td><td class="mdescRight">For applications with their own message loop, reads all data from the network.  <br /></td></tr>
<tr class="separator:a0748d791fd2af516dd93fbadb660d440"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a909f47a00d77569908ca9f180afc87a3" id="r_a909f47a00d77569908ca9f180afc87a3"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a909f47a00d77569908ca9f180afc87a3">coap_run_once</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *ctx, unsigned int timeout_ms)</td></tr>
<tr class="memdesc:a909f47a00d77569908ca9f180afc87a3"><td class="mdescLeft">&#160;</td><td class="mdescRight">The main message processing loop.  <br /></td></tr>
<tr class="separator:a909f47a00d77569908ca9f180afc87a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae6b8ca457dd41f23372f9e9a7159312b" id="r_ae6b8ca457dd41f23372f9e9a7159312b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#ae6b8ca457dd41f23372f9e9a7159312b">coap_handle_dgram</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *ctx, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *data, size_t data_len)</td></tr>
<tr class="memdesc:ae6b8ca457dd41f23372f9e9a7159312b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Parses and interprets a CoAP datagram with context <code>ctx</code>.  <br /></td></tr>
<tr class="separator:ae6b8ca457dd41f23372f9e9a7159312b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5e2cee998ccf618ac07aa54f5e5f8743" id="r_a5e2cee998ccf618ac07aa54f5e5f8743"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a5e2cee998ccf618ac07aa54f5e5f8743">coap_handle_event</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="group__events.html#ga75a08ceb9a855937288ac3996656c872">coap_event_t</a> event, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session)</td></tr>
<tr class="memdesc:a5e2cee998ccf618ac07aa54f5e5f8743"><td class="mdescLeft">&#160;</td><td class="mdescRight">Invokes the event handler of <code>context</code> for the given <code>event</code> and <code>data</code>.  <br /></td></tr>
<tr class="separator:a5e2cee998ccf618ac07aa54f5e5f8743"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a480a3e967feaf00778dedf4c2fc68bd2" id="r_a480a3e967feaf00778dedf4c2fc68bd2"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a480a3e967feaf00778dedf4c2fc68bd2">coap_remove_from_queue</a> (<a class="el" href="structcoap__queue__t.html">coap_queue_t</a> **queue, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> id, <a class="el" href="structcoap__queue__t.html">coap_queue_t</a> **node)</td></tr>
<tr class="memdesc:a480a3e967feaf00778dedf4c2fc68bd2"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function removes the element with given <code>id</code> from the list given list.  <br /></td></tr>
<tr class="separator:a480a3e967feaf00778dedf4c2fc68bd2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7bee391c13b539a24d9f74b2fc23e08a" id="r_a7bee391c13b539a24d9f74b2fc23e08a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a7bee391c13b539a24d9f74b2fc23e08a">coap_wait_ack</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *node)</td></tr>
<tr class="separator:a7bee391c13b539a24d9f74b2fc23e08a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3065434dae5c177558462dddc61d5514" id="r_a3065434dae5c177558462dddc61d5514"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a3065434dae5c177558462dddc61d5514">coap_find_transaction</a> (<a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *queue, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> id)</td></tr>
<tr class="memdesc:a3065434dae5c177558462dddc61d5514"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieves transaction from the queue.  <br /></td></tr>
<tr class="separator:a3065434dae5c177558462dddc61d5514"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab0ffe6312ad95fb07b0212f912cf196c" id="r_ab0ffe6312ad95fb07b0212f912cf196c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#ab0ffe6312ad95fb07b0212f912cf196c">coap_cancel_all_messages</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *token, size_t token_length)</td></tr>
<tr class="memdesc:ab0ffe6312ad95fb07b0212f912cf196c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Cancels all outstanding messages for session <code>session</code> that have the specified token.  <br /></td></tr>
<tr class="separator:ab0ffe6312ad95fb07b0212f912cf196c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:add0197ad2daf24535c85e0ba1d28f099" id="r_add0197ad2daf24535c85e0ba1d28f099"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#add0197ad2daf24535c85e0ba1d28f099">coap_cancel_session_messages</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="coap__io_8h.html#a7ff2bb32137ca684be5539c156bdc418">coap_nack_reason_t</a> reason)</td></tr>
<tr class="memdesc:add0197ad2daf24535c85e0ba1d28f099"><td class="mdescLeft">&#160;</td><td class="mdescRight">Cancels all outstanding messages for session <code>session</code>.  <br /></td></tr>
<tr class="separator:add0197ad2daf24535c85e0ba1d28f099"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7bb944fc52f772655356d95724317401" id="r_a7bb944fc52f772655356d95724317401"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a7bb944fc52f772655356d95724317401">coap_dispatch</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *pdu)</td></tr>
<tr class="memdesc:a7bb944fc52f772655356d95724317401"><td class="mdescLeft">&#160;</td><td class="mdescRight">Dispatches the PDUs from the receive queue in given context.  <br /></td></tr>
<tr class="separator:a7bb944fc52f772655356d95724317401"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a231e9a81ac7c03c3e5c251824a76d7b9" id="r_a231e9a81ac7c03c3e5c251824a76d7b9"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a231e9a81ac7c03c3e5c251824a76d7b9">coap_can_exit</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context)</td></tr>
<tr class="memdesc:a231e9a81ac7c03c3e5c251824a76d7b9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns 1 if there are no messages to send or to dispatch in the context's queues.  <br /></td></tr>
<tr class="separator:a231e9a81ac7c03c3e5c251824a76d7b9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a757eecd5cda6e32472313df73a9297fd" id="r_a757eecd5cda6e32472313df73a9297fd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a757eecd5cda6e32472313df73a9297fd">coap_ticks</a> (<a class="el" href="group__clock.html#ga97ff1502e211b4ee6c3f15a598833438">coap_tick_t</a> *)</td></tr>
<tr class="memdesc:a757eecd5cda6e32472313df73a9297fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the current value of an internal tick counter.  <br /></td></tr>
<tr class="separator:a757eecd5cda6e32472313df73a9297fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9c6736c0418c3adf5e7f6fb76f000cfe" id="r_a9c6736c0418c3adf5e7f6fb76f000cfe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a9c6736c0418c3adf5e7f6fb76f000cfe">coap_option_check_critical</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *ctx, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *pdu, <a class="el" href="group__opt__filter.html#ga001c5b06ae9e02996509516871cb69a8">coap_opt_filter_t</a> unknown)</td></tr>
<tr class="memdesc:a9c6736c0418c3adf5e7f6fb76f000cfe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Verifies that <code>pdu</code> contains no unknown critical options.  <br /></td></tr>
<tr class="separator:a9c6736c0418c3adf5e7f6fb76f000cfe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4b9a31728201d9c7c032513a185854ff" id="r_a4b9a31728201d9c7c032513a185854ff"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a4b9a31728201d9c7c032513a185854ff">coap_wellknown_response</a> (<a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *request)</td></tr>
<tr class="memdesc:a4b9a31728201d9c7c032513a185854ff"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new response for given <code>request</code> with the contents of <code></code>.well-known/core.  <br /></td></tr>
<tr class="separator:a4b9a31728201d9c7c032513a185854ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a816e87e31e2b90ada89eed085f016d93" id="r_a816e87e31e2b90ada89eed085f016d93"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="net_8h.html#a816e87e31e2b90ada89eed085f016d93">coap_calc_timeout</a> (<a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, unsigned char r)</td></tr>
<tr class="memdesc:a816e87e31e2b90ada89eed085f016d93"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the initial timeout based on the session CoAP transmission parameters 'ack_timeout', 'ack_random_factor', and COAP_TICKS_PER_SECOND.  <br /></td></tr>
<tr class="separator:a816e87e31e2b90ada89eed085f016d93"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="ac7a23545549ba965bdcc52ebf53b102f" name="ac7a23545549ba965bdcc52ebf53b102f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac7a23545549ba965bdcc52ebf53b102f">&#9670;&#160;</a></span>coap_context_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="structcoap__context__t.html">coap_context_t</a> <a class="el" href="structcoap__context__t.html">coap_context_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The CoAP stack's global state is stored in a <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a> object. </p>

</div>
</div>
<a id="a4f398929eef5944941ec6aa790f3abea" name="a4f398929eef5944941ec6aa790f3abea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4f398929eef5944941ec6aa790f3abea">&#9670;&#160;</a></span>coap_nack_handler_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* coap_nack_handler_t) (struct <a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *sent, <a class="el" href="coap__io_8h.html#a7ff2bb32137ca684be5539c156bdc418">coap_nack_reason_t</a> reason, const <a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> id)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Negative Acknowedge handler that is used as call-back in <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>CoAP session. </td></tr>
    <tr><td class="paramname">session</td><td>CoAP session. </td></tr>
    <tr><td class="paramname">sent</td><td>The PDU that was transmitted. </td></tr>
    <tr><td class="paramname">reason</td><td>The reason for the NACK. </td></tr>
    <tr><td class="paramname">id</td><td>CoAP transaction ID. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8h_source.html#l00113">113</a> of file <a class="el" href="net_8h_source.html">net.h</a>.</p>

</div>
</div>
<a id="a4441ca51ddb6294729bd5f6971769d5f" name="a4441ca51ddb6294729bd5f6971769d5f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4441ca51ddb6294729bd5f6971769d5f">&#9670;&#160;</a></span>coap_ping_handler_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* coap_ping_handler_t) (struct <a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *received, const <a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> id)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Recieved Ping handler that is used as call-back in <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>CoAP session. </td></tr>
    <tr><td class="paramname">session</td><td>CoAP session. </td></tr>
    <tr><td class="paramname">received</td><td>The PDU that was received. </td></tr>
    <tr><td class="paramname">id</td><td>CoAP transaction ID. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8h_source.html#l00127">127</a> of file <a class="el" href="net_8h_source.html">net.h</a>.</p>

</div>
</div>
<a id="a89aa2bb8a2345d32463a27fa5a4a5acc" name="a89aa2bb8a2345d32463a27fa5a4a5acc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a89aa2bb8a2345d32463a27fa5a4a5acc">&#9670;&#160;</a></span>coap_pong_handler_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* coap_pong_handler_t) (struct <a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *received, const <a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> id)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Recieved Pong handler that is used as call-back in <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>CoAP session. </td></tr>
    <tr><td class="paramname">session</td><td>CoAP session. </td></tr>
    <tr><td class="paramname">received</td><td>The PDU that was received. </td></tr>
    <tr><td class="paramname">id</td><td>CoAP transaction ID. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8h_source.html#l00140">140</a> of file <a class="el" href="net_8h_source.html">net.h</a>.</p>

</div>
</div>
<a id="a548dc6ec3268d22d2a314fa132f548c1" name="a548dc6ec3268d22d2a314fa132f548c1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a548dc6ec3268d22d2a314fa132f548c1">&#9670;&#160;</a></span>coap_queue_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="structcoap__queue__t.html">coap_queue_t</a> <a class="el" href="structcoap__queue__t.html">coap_queue_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Queue entry. </p>

</div>
</div>
<a id="ae74b51652af6ed6620d101dc9a8a2431" name="ae74b51652af6ed6620d101dc9a8a2431"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae74b51652af6ed6620d101dc9a8a2431">&#9670;&#160;</a></span>coap_response_handler_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* coap_response_handler_t) (struct <a class="el" href="structcoap__context__t.html">coap_context_t</a> *context, <a class="el" href="structcoap__session__t.html">coap_session_t</a> *session, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *sent, <a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *received, const <a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> id)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Response handler that is used as call-back in <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>CoAP session. </td></tr>
    <tr><td class="paramname">session</td><td>CoAP session. </td></tr>
    <tr><td class="paramname">sent</td><td>The PDU that was transmitted. </td></tr>
    <tr><td class="paramname">received</td><td>The PDU that was received. </td></tr>
    <tr><td class="paramname">id</td><td>CoAP transaction ID. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8h_source.html#l00098">98</a> of file <a class="el" href="net_8h_source.html">net.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a116b4fec1683a94831f02b3e1a54dcac" name="a116b4fec1683a94831f02b3e1a54dcac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a116b4fec1683a94831f02b3e1a54dcac">&#9670;&#160;</a></span>coap_adjust_basetime()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int coap_adjust_basetime </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__clock.html#ga97ff1502e211b4ee6c3f15a598833438">coap_tick_t</a>&#160;</td>
          <td class="paramname"><em>now</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set sendqueue_basetime in the given context object <code>ctx</code> to <code>now</code>. </p>
<p>This function returns the number of elements in the queue head that have timed out. </p>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00151">151</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a816e87e31e2b90ada89eed085f016d93" name="a816e87e31e2b90ada89eed085f016d93"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a816e87e31e2b90ada89eed085f016d93">&#9670;&#160;</a></span>coap_calc_timeout()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int coap_calc_timeout </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char&#160;</td>
          <td class="paramname"><em>r</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the initial timeout based on the session CoAP transmission parameters 'ack_timeout', 'ack_random_factor', and COAP_TICKS_PER_SECOND. </p>
<p>The calculation requires 'ack_timeout' and 'ack_random_factor' to be in Qx.FRAC_BITS fixed point notation, whereas the passed parameter <code>r</code> is interpreted as the fractional part of a Q0.MAX_BITS random value.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">session</td><td>session timeout is associated with </td></tr>
    <tr><td class="paramname">r</td><td>random value as fractional part of a Q0.MAX_BITS fixed point value </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>COAP_TICKS_PER_SECOND * 'ack_timeout' * (1 + ('ack_random_factor' - 1) * r) </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00798">798</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a231e9a81ac7c03c3e5c251824a76d7b9" name="a231e9a81ac7c03c3e5c251824a76d7b9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a231e9a81ac7c03c3e5c251824a76d7b9">&#9670;&#160;</a></span>coap_can_exit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_can_exit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns 1 if there are no messages to send or to dispatch in the context's queues. </p>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l02321">2321</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="ab0ffe6312ad95fb07b0212f912cf196c" name="ab0ffe6312ad95fb07b0212f912cf196c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab0ffe6312ad95fb07b0212f912cf196c">&#9670;&#160;</a></span>coap_cancel_all_messages()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void coap_cancel_all_messages </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>token</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>token_length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Cancels all outstanding messages for session <code>session</code> that have the specified token. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The context in use. </td></tr>
    <tr><td class="paramname">session</td><td>Session of the messages to remove. </td></tr>
    <tr><td class="paramname">token</td><td>Message token. </td></tr>
    <tr><td class="paramname">token_length</td><td>Actual length of <code>token</code>. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l01484">1484</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="add0197ad2daf24535c85e0ba1d28f099" name="add0197ad2daf24535c85e0ba1d28f099"></a>
<h2 class="memtitle"><span class="permalink"><a href="#add0197ad2daf24535c85e0ba1d28f099">&#9670;&#160;</a></span>coap_cancel_session_messages()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void coap_cancel_session_messages </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="coap__io_8h.html#a7ff2bb32137ca684be5539c156bdc418">coap_nack_reason_t</a>&#160;</td>
          <td class="paramname"><em>reason</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Cancels all outstanding messages for session <code>session</code>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The context in use. </td></tr>
    <tr><td class="paramname">session</td><td>Session of the messages to remove. </td></tr>
    <tr><td class="paramname">reason</td><td>The reasion for the session cancellation </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l01447">1447</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="acc875c3095491f3835f4d252bd72999d" name="acc875c3095491f3835f4d252bd72999d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acc875c3095491f3835f4d252bd72999d">&#9670;&#160;</a></span>coap_context_set_keepalive()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void coap_context_set_keepalive </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>seconds</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the context keepalive timer for sessions. </p>
<p>A keepalive message will be sent after if a session has been inactive, i.e. no packet sent or received, for the given number of seconds. For reliable protocols, a PING message will be sent. If a PONG has not been received before the next PING is due to be sent, the session will considered as disconnected.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a> object. </td></tr>
    <tr><td class="paramname">seconds</td><td>Number of seconds for the inactivity timer, or zero to disable CoAP-level keepalive messages.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 if successful, else 0 </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00417">417</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a35b413b8771487a5384cfe670553276a" name="a35b413b8771487a5384cfe670553276a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a35b413b8771487a5384cfe670553276a">&#9670;&#160;</a></span>coap_context_set_pki()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_context_set_pki </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__dtls__pki__t.html">coap_dtls_pki_t</a> *&#160;</td>
          <td class="paramname"><em>setup_data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the context's default PKI information for a server. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The current <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a> object. </td></tr>
    <tr><td class="paramname">setup_data</td><td>If <code>NULL</code>, PKI authentication will fail. Certificate information required.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>1</code> if successful, else <code>0</code>. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00392">392</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a7b56f148fda46ca44655e1a9b373b97e" name="a7b56f148fda46ca44655e1a9b373b97e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7b56f148fda46ca44655e1a9b373b97e">&#9670;&#160;</a></span>coap_context_set_pki_root_cas()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_context_set_pki_root_cas </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>ca_file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>ca_dir</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the context's default Root CA information for a client or server. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The current <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a> object. </td></tr>
    <tr><td class="paramname">ca_file</td><td>If not <code>NULL</code>, is the full path name of a PEM encoded file containing all the Root CAs to be used. </td></tr>
    <tr><td class="paramname">ca_dir</td><td>If not <code>NULL</code>, points to a directory containing PEM encoded files containing all the Root CAs to be used.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>1</code> if successful, else <code>0</code>. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00407">407</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a665601c3c9ac88ef92125c1e62d679b2" name="a665601c3c9ac88ef92125c1e62d679b2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a665601c3c9ac88ef92125c1e62d679b2">&#9670;&#160;</a></span>coap_context_set_psk()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_context_set_psk </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>hint</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>key_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the context's default PSK hint and/or key for a server. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The current <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a> object. </td></tr>
    <tr><td class="paramname">hint</td><td>The default PSK server hint sent to a client. If <code>NULL</code>, PSK authentication is disabled. Empty string is a valid hint. </td></tr>
    <tr><td class="paramname">key</td><td>The default PSK key. If <code>NULL</code>, PSK authentication will fail. </td></tr>
    <tr><td class="paramname">key_len</td><td>The default PSK key's length. If <code>0</code>, PSK authentication will fail.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>1</code> if successful, else <code>0</code>. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00349">349</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a2c1e86998c712346baf2d116dbf1ac7f" name="a2c1e86998c712346baf2d116dbf1ac7f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2c1e86998c712346baf2d116dbf1ac7f">&#9670;&#160;</a></span>coap_delete_all()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void coap_delete_all </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *&#160;</td>
          <td class="paramname"><em>queue</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Removes all items from given <code>queue</code> and frees the allocated storage. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">queue</td><td>The queue to delete. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00245">245</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a44c39a2314035989d3e07b9d9328e08c" name="a44c39a2314035989d3e07b9d9328e08c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a44c39a2314035989d3e07b9d9328e08c">&#9670;&#160;</a></span>coap_delete_node()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_delete_node </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *&#160;</td>
          <td class="paramname"><em>node</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Destroys specified <code>node</code>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">node</td><td>Node entry to remove.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>1</code> node deleted from queue, <code>0</code> failure. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00225">225</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a7bb944fc52f772655356d95724317401" name="a7bb944fc52f772655356d95724317401"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7bb944fc52f772655356d95724317401">&#9670;&#160;</a></span>coap_dispatch()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void coap_dispatch </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td>
          <td class="paramname"><em>pdu</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Dispatches the PDUs from the receive queue in given context. </p>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l02169">2169</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a3065434dae5c177558462dddc61d5514" name="a3065434dae5c177558462dddc61d5514"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3065434dae5c177558462dddc61d5514">&#9670;&#160;</a></span>coap_find_transaction()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> * coap_find_transaction </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *&#160;</td>
          <td class="paramname"><em>queue</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a>&#160;</td>
          <td class="paramname"><em>id</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Retrieves transaction from the queue. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">queue</td><td>The transaction queue to be searched. </td></tr>
    <tr><td class="paramname">session</td><td>The session to find. </td></tr>
    <tr><td class="paramname">id</td><td>The transaction id to find.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the transaction object or <code>NULL</code> if not found. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l01525">1525</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a4a0717822713783908dd33d300440b2e" name="a4a0717822713783908dd33d300440b2e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4a0717822713783908dd33d300440b2e">&#9670;&#160;</a></span>coap_free_context()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void coap_free_context </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>CoAP stack context must be released with <a class="el" href="net_8h.html#a4a0717822713783908dd33d300440b2e" title="CoAP stack context must be released with coap_free_context().">coap_free_context()</a>. </p>
<p>This function clears all entries from the receive queue and send queue and deletes the resources that have been registered with <code>context</code>, and frees the attached endpoints.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The current <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a> object to free off. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00518">518</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="aba2c62403587c8ee4e87adaffe9202da" name="aba2c62403587c8ee4e87adaffe9202da"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aba2c62403587c8ee4e87adaffe9202da">&#9670;&#160;</a></span>coap_get_app_data()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void * coap_get_app_data </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns any application-specific data that has been stored with <code>context</code> using the function <a class="el" href="net_8h.html#ace22e7d3745fb725552c929b4da55c61" title="Stores data with the given CoAP context.">coap_set_app_data()</a>. </p>
<p>This function will return <code>NULL</code> if no data has been stored.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The CoAP context.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The data previously stored or <code>NULL</code> if not data stored. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00512">512</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="ae6b8ca457dd41f23372f9e9a7159312b" name="ae6b8ca457dd41f23372f9e9a7159312b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae6b8ca457dd41f23372f9e9a7159312b">&#9670;&#160;</a></span>coap_handle_dgram()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_handle_dgram </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>data_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Parses and interprets a CoAP datagram with context <code>ctx</code>. </p>
<p>This function returns <code>0</code> if the datagram was handled, or a value less than zero on error.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ctx</td><td>The current CoAP context. </td></tr>
    <tr><td class="paramname">session</td><td>The current CoAP session. </td></tr>
    <tr><td class="paramname">data</td><td>The received packet'd data. </td></tr>
    <tr><td class="paramname">data_len</td><td>The received packet'd data length.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>0</code> if message was handled successfully, or less than zero on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l01369">1369</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a5e2cee998ccf618ac07aa54f5e5f8743" name="a5e2cee998ccf618ac07aa54f5e5f8743"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5e2cee998ccf618ac07aa54f5e5f8743">&#9670;&#160;</a></span>coap_handle_event()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_handle_event </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__events.html#ga75a08ceb9a855937288ac3996656c872">coap_event_t</a>&#160;</td>
          <td class="paramname"><em>event</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Invokes the event handler of <code>context</code> for the given <code>event</code> and <code>data</code>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The CoAP context whose event handler is to be called. </td></tr>
    <tr><td class="paramname">event</td><td>The event to deliver. </td></tr>
    <tr><td class="paramname">session</td><td>The session related to <code>event</code>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The result from the associated event handler or 0 if none was registered. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l02310">2310</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a80d2c3b0141e98bf3f7914e7e59b9530" name="a80d2c3b0141e98bf3f7914e7e59b9530"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a80d2c3b0141e98bf3f7914e7e59b9530">&#9670;&#160;</a></span>coap_insert_node()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_insert_node </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> **&#160;</td>
          <td class="paramname"><em>queue</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *&#160;</td>
          <td class="paramname"><em>node</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Adds <code>node</code> to given <code>queue</code>, ordered by variable t in <code>node</code>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">queue</td><td>Queue to add to. </td></tr>
    <tr><td class="paramname">node</td><td>Node entry to add to Queue.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>1</code> added to queue, <code>0</code> failure. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00188">188</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a1ab369ca0a3c4fe7f8a9e0536346ff71" name="a1ab369ca0a3c4fe7f8a9e0536346ff71"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1ab369ca0a3c4fe7f8a9e0536346ff71">&#9670;&#160;</a></span>coap_new_context()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcoap__context__t.html">coap_context_t</a> * coap_new_context </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structcoap__address__t.html">coap_address_t</a> *&#160;</td>
          <td class="paramname"><em>listen_addr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a new <a class="el" href="structcoap__context__t.html" title="The CoAP stack&#39;s global state is stored in a coap_context_t object.">coap_context_t</a> object that will hold the CoAP stack status. </p>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00422">422</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="aa54bb684429ee455f119fc5fb1feb197" name="aa54bb684429ee455f119fc5fb1feb197"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa54bb684429ee455f119fc5fb1feb197">&#9670;&#160;</a></span>coap_new_error_response()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> * coap_new_error_response </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td>
          <td class="paramname"><em>request</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char&#160;</td>
          <td class="paramname"><em>code</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__opt__filter.html#ga001c5b06ae9e02996509516871cb69a8">coap_opt_filter_t</a>&#160;</td>
          <td class="paramname"><em>opts</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a new ACK PDU with specified error <code>code</code>. </p>
<p>The options specified by the filter expression <code>opts</code> will be copied from the original request contained in <code>request</code>. Unless <code>SHORT_ERROR_RESPONSE</code> was defined at build time, the textual reason phrase for <code>code</code> will be added as payload, with Content-Type <code>0</code>. This function returns a pointer to the new response message, or <code>NULL</code> on error. The storage allocated for the new message must be relased with <a class="el" href="mem_8h.html#a1e46a1505bb13f03fdacd5d1b32502a6" title="Wrapper function to coap_free_type() for backwards compatibility.">coap_free()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">request</td><td>Specification of the received (confirmable) request. </td></tr>
    <tr><td class="paramname">code</td><td>The error code to set. </td></tr>
    <tr><td class="paramname">opts</td><td>An option filter that specifies which options to copy from the original request in <code>node</code>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the new message or <code>NULL</code> on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l01533">1533</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="ade36148140b152d713b23d17bbcf0024" name="ade36148140b152d713b23d17bbcf0024"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ade36148140b152d713b23d17bbcf0024">&#9670;&#160;</a></span>coap_new_message_id()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> uint16_t coap_new_message_id </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns a new message id and updates <code>session-&gt;tx_mid</code> accordingly. </p>
<p>The message id is returned in network byte order to make it easier to read in tracing tools.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">session</td><td>The current <a class="el" href="structcoap__session__t.html">coap_session_t</a> object.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Incremented message id in network byte order. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8h_source.html#l00379">379</a> of file <a class="el" href="net_8h_source.html">net.h</a>.</p>

</div>
</div>
<a id="adbf4c617bdb13f0b61f83dca2ecdcc9e" name="adbf4c617bdb13f0b61f83dca2ecdcc9e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adbf4c617bdb13f0b61f83dca2ecdcc9e">&#9670;&#160;</a></span>coap_new_node()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> * coap_new_node </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a new node suitable for adding to the CoAP sendqueue. </p>
<dl class="section return"><dt>Returns</dt><dd>New node entry, or <code>NULL</code> if failure. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00254">254</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a9c6736c0418c3adf5e7f6fb76f000cfe" name="a9c6736c0418c3adf5e7f6fb76f000cfe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9c6736c0418c3adf5e7f6fb76f000cfe">&#9670;&#160;</a></span>coap_option_check_critical()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_option_check_critical </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td>
          <td class="paramname"><em>pdu</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__opt__filter.html#ga001c5b06ae9e02996509516871cb69a8">coap_opt_filter_t</a>&#160;</td>
          <td class="paramname"><em>unknown</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Verifies that <code>pdu</code> contains no unknown critical options. </p>
<p>Options must be registered at <code>ctx</code>, using the function <a class="el" href="net_8h.html#a696acd1012ad1c2dba081ee5bea54fd8" title="Registers the option type type with the given context object ctx.">coap_register_option()</a>. A basic set of options is registered automatically by <a class="el" href="net_8h.html#a1ab369ca0a3c4fe7f8a9e0536346ff71" title="Creates a new coap_context_t object that will hold the CoAP stack status.">coap_new_context()</a>. This function returns <code>1</code> if <code>pdu</code> is ok, <code>0</code> otherwise. The given filter object <code>unknown</code> will be updated with the unknown options. As only <code>COAP_MAX_OPT</code> options can be signalled this way, remaining options must be examined manually.</p>
<div class="fragment"><div class="line"><a class="code hl_typedef" href="group__opt__filter.html#ga001c5b06ae9e02996509516871cb69a8">coap_opt_filter_t</a> f = COAP_OPT_NONE;</div>
<div class="line"><a class="code hl_struct" href="structcoap__opt__iterator__t.html">coap_opt_iterator_t</a> opt_iter;</div>
<div class="line"> </div>
<div class="line"><span class="keywordflow">if</span> (<a class="code hl_function" href="net_8c.html#a9c6736c0418c3adf5e7f6fb76f000cfe">coap_option_check_critical</a>(ctx, pdu, f) == 0) {</div>
<div class="line">  <a class="code hl_function" href="group__opt__filter.html#gaa76930050882387b0f5c7d0246e14440">coap_option_iterator_init</a>(pdu, &amp;opt_iter, f);</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">while</span> (<a class="code hl_function" href="group__opt__filter.html#ga19d4dbbc03ef362996964fbfdd1d4c7b">coap_option_next</a>(&amp;opt_iter)) {</div>
<div class="line">    <span class="keywordflow">if</span> (opt_iter.<a class="code hl_variable" href="structcoap__opt__iterator__t.html#a0df30f4a2bb85deb3d493fded6967b9d">type</a> &amp; 0x01) {</div>
<div class="line">      ... handle unknown critical option in opt_iter ...</div>
<div class="line">    }</div>
<div class="line">  }</div>
<div class="line">}</div>
<div class="ttc" id="agroup__opt__filter_html_ga001c5b06ae9e02996509516871cb69a8"><div class="ttname"><a href="group__opt__filter.html#ga001c5b06ae9e02996509516871cb69a8">coap_opt_filter_t</a></div><div class="ttdeci">uint16_t coap_opt_filter_t[COAP_OPT_FILTER_SIZE]</div><div class="ttdoc">Fixed-size vector we use for option filtering.</div><div class="ttdef"><b>Definition</b> <a href="option_8h_source.html#l00119">option.h:119</a></div></div>
<div class="ttc" id="agroup__opt__filter_html_ga19d4dbbc03ef362996964fbfdd1d4c7b"><div class="ttname"><a href="group__opt__filter.html#ga19d4dbbc03ef362996964fbfdd1d4c7b">coap_option_next</a></div><div class="ttdeci">coap_opt_t * coap_option_next(coap_opt_iterator_t *oi)</div><div class="ttdoc">Updates the iterator oi to point to the next option.</div><div class="ttdef"><b>Definition</b> <a href="option_8c_source.html#l00157">option.c:157</a></div></div>
<div class="ttc" id="agroup__opt__filter_html_gaa76930050882387b0f5c7d0246e14440"><div class="ttname"><a href="group__opt__filter.html#gaa76930050882387b0f5c7d0246e14440">coap_option_iterator_init</a></div><div class="ttdeci">coap_opt_iterator_t * coap_option_iterator_init(const coap_pdu_t *pdu, coap_opt_iterator_t *oi, const coap_opt_filter_t filter)</div><div class="ttdoc">Initializes the given option iterator oi to point to the beginning of the pdu's option list.</div><div class="ttdef"><b>Definition</b> <a href="option_8c_source.html#l00121">option.c:121</a></div></div>
<div class="ttc" id="anet_8c_html_a9c6736c0418c3adf5e7f6fb76f000cfe"><div class="ttname"><a href="net_8c.html#a9c6736c0418c3adf5e7f6fb76f000cfe">coap_option_check_critical</a></div><div class="ttdeci">int coap_option_check_critical(coap_context_t *ctx, coap_pdu_t *pdu, coap_opt_filter_t unknown)</div><div class="ttdoc">Verifies that pdu contains no unknown critical options.</div><div class="ttdef"><b>Definition</b> <a href="net_8c_source.html#l00561">net.c:561</a></div></div>
<div class="ttc" id="astructcoap__opt__iterator__t_html"><div class="ttname"><a href="structcoap__opt__iterator__t.html">coap_opt_iterator_t</a></div><div class="ttdoc">Iterator to run through PDU options.</div><div class="ttdef"><b>Definition</b> <a href="option_8h_source.html#l00237">option.h:237</a></div></div>
<div class="ttc" id="astructcoap__opt__iterator__t_html_a0df30f4a2bb85deb3d493fded6967b9d"><div class="ttname"><a href="structcoap__opt__iterator__t.html#a0df30f4a2bb85deb3d493fded6967b9d">coap_opt_iterator_t::type</a></div><div class="ttdeci">uint16_t type</div><div class="ttdoc">decoded option type</div><div class="ttdef"><b>Definition</b> <a href="option_8h_source.html#l00239">option.h:239</a></div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ctx</td><td>The context where all known options are registered. </td></tr>
    <tr><td class="paramname">pdu</td><td>The PDU to check. </td></tr>
    <tr><td class="paramname">unknown</td><td>The output filter that will be updated to indicate the unknown critical options found in <code>pdu</code>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>1</code> if everything was ok, <code>0</code> otherwise. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00561">561</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a4a9f7d31eafd7d82776f9b1a9291eea0" name="a4a9f7d31eafd7d82776f9b1a9291eea0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4a9f7d31eafd7d82776f9b1a9291eea0">&#9670;&#160;</a></span>coap_peek_next()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> * coap_peek_next </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the next pdu to send without removing from sendqeue. </p>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00270">270</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a740acba1e579ecec3c67eca3b7522164" name="a740acba1e579ecec3c67eca3b7522164"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a740acba1e579ecec3c67eca3b7522164">&#9670;&#160;</a></span>coap_pop_next()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> * coap_pop_next </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the next pdu to send and removes it from the sendqeue. </p>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00278">278</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a0748d791fd2af516dd93fbadb660d440" name="a0748d791fd2af516dd93fbadb660d440"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0748d791fd2af516dd93fbadb660d440">&#9670;&#160;</a></span>coap_read()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void coap_read </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__clock.html#ga97ff1502e211b4ee6c3f15a598833438">coap_tick_t</a>&#160;</td>
          <td class="paramname"><em>now</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>For applications with their own message loop, reads all data from the network. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ctx</td><td>The CoAP context </td></tr>
    <tr><td class="paramname">now</td><td>Current time </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l01319">1319</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="ae150823383d9c96c22076e37de9a8192" name="ae150823383d9c96c22076e37de9a8192"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae150823383d9c96c22076e37de9a8192">&#9670;&#160;</a></span>coap_register_nack_handler()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> void coap_register_nack_handler </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="net_8h.html#a4f398929eef5944941ec6aa790f3abea">coap_nack_handler_t</a>&#160;</td>
          <td class="paramname"><em>handler</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Registers a new message handler that is called whenever a confirmable message (request or response) is dropped after all retries have been exhausted, or a rst message was received, or a network or TLS level event was received that indicates delivering the message is not possible. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The context to register the handler for. </td></tr>
    <tr><td class="paramname">handler</td><td>The nack handler to register. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8h_source.html#l00245">245</a> of file <a class="el" href="net_8h_source.html">net.h</a>.</p>

</div>
</div>
<a id="a696acd1012ad1c2dba081ee5bea54fd8" name="a696acd1012ad1c2dba081ee5bea54fd8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a696acd1012ad1c2dba081ee5bea54fd8">&#9670;&#160;</a></span>coap_register_option()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> void coap_register_option </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>type</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Registers the option type <code>type</code> with the given context object <code>ctx</code>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ctx</td><td>The context to use. </td></tr>
    <tr><td class="paramname">type</td><td>The option type to register. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8h_source.html#l00283">283</a> of file <a class="el" href="net_8h_source.html">net.h</a>.</p>

</div>
</div>
<a id="a0271cb8bba386ce230dd30496bbc8670" name="a0271cb8bba386ce230dd30496bbc8670"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0271cb8bba386ce230dd30496bbc8670">&#9670;&#160;</a></span>coap_register_ping_handler()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> void coap_register_ping_handler </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="net_8h.html#a4441ca51ddb6294729bd5f6971769d5f">coap_ping_handler_t</a>&#160;</td>
          <td class="paramname"><em>handler</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Registers a new message handler that is called whenever a CoAP Ping message is received. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The context to register the handler for. </td></tr>
    <tr><td class="paramname">handler</td><td>The ping handler to register. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8h_source.html#l00258">258</a> of file <a class="el" href="net_8h_source.html">net.h</a>.</p>

</div>
</div>
<a id="a4af0d2a6075413637f8099fc9c59896b" name="a4af0d2a6075413637f8099fc9c59896b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4af0d2a6075413637f8099fc9c59896b">&#9670;&#160;</a></span>coap_register_pong_handler()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> void coap_register_pong_handler </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="net_8h.html#a89aa2bb8a2345d32463a27fa5a4a5acc">coap_pong_handler_t</a>&#160;</td>
          <td class="paramname"><em>handler</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Registers a new message handler that is called whenever a CoAP Pong message is received. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The context to register the handler for. </td></tr>
    <tr><td class="paramname">handler</td><td>The pong handler to register. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8h_source.html#l00271">271</a> of file <a class="el" href="net_8h_source.html">net.h</a>.</p>

</div>
</div>
<a id="a7cba9a2fabbd31cb622b828d2415a12c" name="a7cba9a2fabbd31cb622b828d2415a12c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7cba9a2fabbd31cb622b828d2415a12c">&#9670;&#160;</a></span>coap_register_response_handler()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> void coap_register_response_handler </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="net_8h.html#ae74b51652af6ed6620d101dc9a8a2431">coap_response_handler_t</a>&#160;</td>
          <td class="paramname"><em>handler</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Registers a new message handler that is called whenever a response was received that matches an ongoing transaction. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The context to register the handler for. </td></tr>
    <tr><td class="paramname">handler</td><td>The response handler to register. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8h_source.html#l00230">230</a> of file <a class="el" href="net_8h_source.html">net.h</a>.</p>

</div>
</div>
<a id="a480a3e967feaf00778dedf4c2fc68bd2" name="a480a3e967feaf00778dedf4c2fc68bd2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a480a3e967feaf00778dedf4c2fc68bd2">&#9670;&#160;</a></span>coap_remove_from_queue()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_remove_from_queue </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> **&#160;</td>
          <td class="paramname"><em>queue</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a>&#160;</td>
          <td class="paramname"><em>id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> **&#160;</td>
          <td class="paramname"><em>node</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function removes the element with given <code>id</code> from the list given list. </p>
<p>If <code>id</code> was found, <code>node</code> is updated to point to the removed element. Note that the storage allocated by <code>node</code> is <b>not</b> released. The caller must do this manually using <a class="el" href="net_8h.html#a44c39a2314035989d3e07b9d9328e08c" title="Destroys specified node.">coap_delete_node()</a>. This function returns <code>1</code> if the element with id <code>id</code> was found, <code>0</code> otherwise. For a return value of <code>0</code>, the contents of <code>node</code> is undefined.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">queue</td><td>The queue to search for <code>id</code>. </td></tr>
    <tr><td class="paramname">session</td><td>The session to look for. </td></tr>
    <tr><td class="paramname">id</td><td>The transaction id to look for. </td></tr>
    <tr><td class="paramname">node</td><td>If found, <code>node</code> is updated to point to the removed node. You must release the storage pointed to by <code>node</code> manually.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>1</code> if <code>id</code> was found, <code>0</code> otherwise. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l01397">1397</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a9900c032b74bd57f67d489484a2b3207" name="a9900c032b74bd57f67d489484a2b3207"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9900c032b74bd57f67d489484a2b3207">&#9670;&#160;</a></span>coap_retransmit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> coap_retransmit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *&#160;</td>
          <td class="paramname"><em>node</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Handles retransmissions of confirmable messages. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The CoAP context. </td></tr>
    <tr><td class="paramname">node</td><td>The node to retransmit.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The message id of the sent message or <code>COAP_INVALID_TID</code> on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00931">931</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a909f47a00d77569908ca9f180afc87a3" name="a909f47a00d77569908ca9f180afc87a3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a909f47a00d77569908ca9f180afc87a3">&#9670;&#160;</a></span>coap_run_once()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_run_once </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>timeout_ms</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The main message processing loop. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ctx</td><td>The CoAP context </td></tr>
    <tr><td class="paramname">timeout_ms</td><td>Minimum number of milliseconds to wait for new messages before returning. If zero the call will block until at least one packet is sent or received.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>number of milliseconds spent or <code>-1</code> if there was an error </dd></dl>

</div>
</div>
<a id="ab0b0b5db03427c4313c01ec2b12cf8ed" name="ab0b0b5db03427c4313c01ec2b12cf8ed"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab0b0b5db03427c4313c01ec2b12cf8ed">&#9670;&#160;</a></span>coap_send()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> coap_send </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td>
          <td class="paramname"><em>pdu</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sends a CoAP message to given peer. </p>
<p>The memory that is allocated by pdu will be released by <a class="el" href="net_8h.html#ab0b0b5db03427c4313c01ec2b12cf8ed" title="Sends a CoAP message to given peer.">coap_send()</a>. The caller must not use the pdu after calling <a class="el" href="net_8h.html#ab0b0b5db03427c4313c01ec2b12cf8ed" title="Sends a CoAP message to given peer.">coap_send()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">session</td><td>The CoAP session. </td></tr>
    <tr><td class="paramname">pdu</td><td>The CoAP PDU to send.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The message id of the sent message or <code>COAP_INVALID_TID</code> on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00876">876</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="aba278b109415057d15196fa46afee970" name="aba278b109415057d15196fa46afee970"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aba278b109415057d15196fa46afee970">&#9670;&#160;</a></span>coap_send_ack()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> coap_send_ack </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td>
          <td class="paramname"><em>request</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sends an ACK message with code <code>0</code> for the specified <code>request</code> to <code>dst</code>. </p>
<p>This function returns the corresponding transaction id if the message was sent or <code>COAP_INVALID_TID</code> on error.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">session</td><td>The CoAP session. </td></tr>
    <tr><td class="paramname">request</td><td>The request to be acknowledged.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The transaction id if ACK was sent or <code>COAP_INVALID_TID</code> on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00613">613</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="ab31cd76353f751ec4dc5c033152df575" name="ab31cd76353f751ec4dc5c033152df575"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab31cd76353f751ec4dc5c033152df575">&#9670;&#160;</a></span>coap_send_error()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> coap_send_error </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td>
          <td class="paramname"><em>request</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char&#160;</td>
          <td class="paramname"><em>code</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__opt__filter.html#ga001c5b06ae9e02996509516871cb69a8">coap_opt_filter_t</a>&#160;</td>
          <td class="paramname"><em>opts</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sends an error response with code <code>code</code> for request <code>request</code> to <code>dst</code>. </p>
<p><code>opts</code> will be passed to <a class="el" href="net_8h.html#aa54bb684429ee455f119fc5fb1feb197" title="Creates a new ACK PDU with specified error code.">coap_new_error_response()</a> to copy marked options from the request. This function returns the transaction id if the message was sent, or <code>COAP_INVALID_TID</code> otherwise.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">session</td><td>The CoAP session. </td></tr>
    <tr><td class="paramname">request</td><td>The original request to respond to. </td></tr>
    <tr><td class="paramname">code</td><td>The response code. </td></tr>
    <tr><td class="paramname">opts</td><td>A filter that specifies the options to copy from the <code>request</code>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The transaction id if the message was sent, or <code>COAP_INVALID_TID</code> otherwise. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00754">754</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a6aa830b46188549b51773f724eb8e752" name="a6aa830b46188549b51773f724eb8e752"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6aa830b46188549b51773f724eb8e752">&#9670;&#160;</a></span>coap_send_message_type()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> coap_send_message_type </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td>
          <td class="paramname"><em>request</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char&#160;</td>
          <td class="paramname"><em>type</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Helper funktion to create and send a message with <code>type</code> (usually ACK or RST). </p>
<p>This function returns <code>COAP_INVALID_TID</code> when the message was not sent, a valid transaction id otherwise.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">session</td><td>The CoAP session. </td></tr>
    <tr><td class="paramname">request</td><td>The request that should be responded to. </td></tr>
    <tr><td class="paramname">type</td><td>Which type to set. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>transaction id on success or <code>COAP_INVALID_TID</code> otherwise. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00772">772</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a5854b1394bfddd574e48af116e3aaaf9" name="a5854b1394bfddd574e48af116e3aaaf9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5854b1394bfddd574e48af116e3aaaf9">&#9670;&#160;</a></span>coap_send_rst()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="libcoap_8h.html#a58b4446dccd0b8c21b3532ef6b77a57d">COAP_STATIC_INLINE</a> <a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> coap_send_rst </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td>
          <td class="paramname"><em>request</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sends an RST message with code <code>0</code> for the specified <code>request</code> to <code>dst</code>. </p>
<p>This function returns the corresponding transaction id if the message was sent or <code>COAP_INVALID_TID</code> on error.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">session</td><td>The CoAP session. </td></tr>
    <tr><td class="paramname">request</td><td>The request to be reset.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The transaction id if RST was sent or <code>COAP_INVALID_TID</code> on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8h_source.html#l00495">495</a> of file <a class="el" href="net_8h_source.html">net.h</a>.</p>

</div>
</div>
<a id="ace22e7d3745fb725552c929b4da55c61" name="ace22e7d3745fb725552c929b4da55c61"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ace22e7d3745fb725552c929b4da55c61">&#9670;&#160;</a></span>coap_set_app_data()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void coap_set_app_data </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Stores <code>data</code> with the given CoAP context. </p>
<p>This function overwrites any value that has previously been stored with <code>context</code>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The CoAP context. </td></tr>
    <tr><td class="paramname">data</td><td>The data to store with wih the context. Note that this data must be valid during the lifetime of <code>context</code>. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00506">506</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a757eecd5cda6e32472313df73a9297fd" name="a757eecd5cda6e32472313df73a9297fd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a757eecd5cda6e32472313df73a9297fd">&#9670;&#160;</a></span>coap_ticks()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void coap_ticks </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__clock.html#ga97ff1502e211b4ee6c3f15a598833438">coap_tick_t</a> *&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the current value of an internal tick counter. </p>
<p>The counter counts <code>COAP_TICKS_PER_SECOND</code> ticks every second. </p>

</div>
</div>
<a id="a7bee391c13b539a24d9f74b2fc23e08a" name="a7bee391c13b539a24d9f74b2fc23e08a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7bee391c13b539a24d9f74b2fc23e08a">&#9670;&#160;</a></span>coap_wait_ack()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pdu_8h.html#ac60fb9284ace878df3db4a2d621d9a8d">coap_tid_t</a> coap_wait_ack </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__queue__t.html">coap_queue_t</a> *&#160;</td>
          <td class="paramname"><em>node</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l00824">824</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="a4b9a31728201d9c7c032513a185854ff" name="a4b9a31728201d9c7c032513a185854ff"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4b9a31728201d9c7c032513a185854ff">&#9670;&#160;</a></span>coap_wellknown_response()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> * coap_wellknown_response </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__session__t.html">coap_session_t</a> *&#160;</td>
          <td class="paramname"><em>session</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__pdu__t.html">coap_pdu_t</a> *&#160;</td>
          <td class="paramname"><em>request</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a new response for given <code>request</code> with the contents of <code></code>.well-known/core. </p>
<p>The result is NULL on error or a newly allocated PDU that must be either sent with coap_sent() or released by <a class="el" href="pdu_8c.html#a48581f968a30ef4278702eb1c16b7a90" title="Dispose of an CoAP PDU and frees associated storage.">coap_delete_pdu()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">context</td><td>The current coap context to use. </td></tr>
    <tr><td class="paramname">session</td><td>The CoAP session. </td></tr>
    <tr><td class="paramname">request</td><td>The request for <code></code>.well-known/core .</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A new 2.05 response for <code></code>.well-known/core or NULL on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="net_8c_source.html#l01649">1649</a> of file <a class="el" href="net_8c_source.html">net.c</a>.</p>

</div>
</div>
<a id="aaac86ac50793f309678e4951ecf8863f" name="aaac86ac50793f309678e4951ecf8863f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaac86ac50793f309678e4951ecf8863f">&#9670;&#160;</a></span>coap_write()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int coap_write </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__context__t.html">coap_context_t</a> *&#160;</td>
          <td class="paramname"><em>ctx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcoap__socket__t.html">coap_socket_t</a> *&#160;</td>
          <td class="paramname"><em>sockets</em>[], </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>max_sockets</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int *&#160;</td>
          <td class="paramname"><em>num_sockets</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__clock.html#ga97ff1502e211b4ee6c3f15a598833438">coap_tick_t</a>&#160;</td>
          <td class="paramname"><em>now</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>For applications with their own message loop, send all pending retransmits and return the list of sockets with events to wait for and the next timeout The application should call coap_read, then coap_write again when any condition below is true: </p>
<ul>
<li>data is available on any of the sockets with the COAP_SOCKET_WANT_READ</li>
<li>an incoming connection is pending in the listen queue and the COAP_SOCKET_WANT_ACCEPT flag is set</li>
<li>at least some data can be written without blocking on any of the sockets with the COAP_SOCKET_WANT_WRITE flag set</li>
<li>a connection event occured (success or failure) and the COAP_SOCKET_WANT_CONNECT flag is set</li>
<li>the timeout has expired Before calling coap_read or coap_write again, the application should position COAP_SOCKET_CAN_READ and COAP_SOCKET_CAN_WRITE flags as applicable.</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ctx</td><td>The CoAP context </td></tr>
    <tr><td class="paramname">sockets</td><td>array of socket descriptors, filled on output </td></tr>
    <tr><td class="paramname">max_sockets</td><td>size of socket array. </td></tr>
    <tr><td class="paramname">num_sockets</td><td>pointer to the number of valid entries in the socket arrays on output </td></tr>
    <tr><td class="paramname">now</td><td>Current time.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>timeout as maxmimum number of milliseconds that the application should wait for network events or 0 if the application should wait forever. </dd></dl>

<p class="definition">Definition at line <a class="el" href="coap__io_8c_source.html#l01117">1117</a> of file <a class="el" href="coap__io_8c_source.html">coap_io.c</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_a14d23a24002734ac2a3b997119f008e.html">coap2</a></li><li class="navelem"><a class="el" href="net_8h.html">net.h</a></li>
    <li class="footer">Generated on Fri Dec 27 2024 09:57:44 for libcoap by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
  </ul>
</div>
</body>
</html>
